package com.mangguo.tingjian.content.controller;


import com.mangguo.tingjian.common.Result;
import com.mangguo.tingjian.content.dto.UvpvCountResult;
import com.mangguo.tingjian.content.service.IDwClickService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * click同步表 前端控制器
 * </p>
 *
 * @author auto
 * @since 2019-11-27
 */
@RestController
@RequestMapping("/content/dw-click")
@AllArgsConstructor
public class DwClickController {
    private final IDwClickService dwClickService;

    @GetMapping("/pv/{lvl1}/{lvl2}/{start}/{end}")
    public Result<List<UvpvCountResult>> topPvByLvlBetweenDate(@PathVariable("lvl1") Long lvl1,
                                                               @PathVariable("lvl2") Long lvl2,
                                                               @PathVariable("start") Integer start,
                                                               @PathVariable("end") Integer end){
        return Result.success(dwClickService.topPvByLvlBetweenDate(start, end, lvl1, lvl2));
    }

    @GetMapping("/uv/{lvl1}/{lvl2}/{start}/{end}")
    public Result<List<UvpvCountResult>> topUvByLvlBetweenDate(@PathVariable("lvl1") Long lvl1,
                                                               @PathVariable("lvl2") Long lvl2,
                                                               @PathVariable("start") Integer start,
                                                               @PathVariable("end") Integer end){
        return Result.success(dwClickService.topUvByLvlBetweenDate(start, end, lvl1, lvl2));
    }
}
